package com.ywz.project.system.controller;

import com.ywz.common.ResultResp;
import com.ywz.project.system.dto.req.PermissionPageReq;
import com.ywz.project.system.service.SysPermissionApiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 类描述 -> 权限管理API
 *
 * @Author: ywz
 * @Date: 2024/10/27
 */
@Api(tags = "权限管理API")
@RestController
@RequestMapping("/system/permission")
public class SysPermissionApiController {
    @Resource
    private SysPermissionApiService sysPermissionApiService;

    /**
     * 方法描述 -> 获取权限分页
     *
     * @param req 请求参数
     * @Author: ywz
     * @Date: 2024/11/05
     */
    @GetMapping("/getPermissionPage")
    @ApiOperation("获取权限分页")
    public ResultResp getPermissionPage(PermissionPageReq req) {
        return sysPermissionApiService.getPermissionPage(req);
    }

    /**
     * 方法描述 -> 根据角色id集合获取权限集合
     *
     * @param roleIds 角色id集合
     * @Author: ywz
     * @Date: 2024/11/08
     */
    @GetMapping("/getPermissionListByRoleId")
    @ApiOperation("根据角色id集合获取权限集合")
    public ResultResp getPermissionListByRoleId(String roleIds) {
        return sysPermissionApiService.getPermissionListByRoleId(roleIds);
    }
}
